home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
tp6_new.zip
/
TP6.DOC
< prev
Wrap
Text File
|
1990-10-01
|
14KB
|
358 lines
What will be new with Turbo Pascal v6.0?
It seems that Turbo Pascal v6.0 should be out, ummm, probably around the
end of the year (1990 that is). Sometime around December, and maybe even
January, but there's a lot of promise for the new version! This is TRUE
information about Turbo Pascal v6.0, no bullshit whatsoever. This
information was extracted right out of it!!!! Well you seem to be very
anxious so here ya go! Well jeez! Don't have a phucking spaz!
Anonymous
Turbo Pascal 6.0 has many new features including:
o Turbo Vision - An object-oriented application framework. Turbo
Vision allows you to create applications with overlapping windows,
pull down menus, dialogs and mouse support. Many example programs
are included that show off the power and ease of Turbo Vision.
o New IDE - All new Integrated Development Environment built in Turbo
Pascal using Turbo Vision. Enhancements include multiple
overlapping windows, multi-file editing of files larger than 64K
and complete mouse support. There is an online hypertext help
system with copy-and-paste program examples. There is also a new
register window that allows you to view the contents of all CPU
registers.
o New extended memory command-line compiler lets the compiler
run in protected mode and use extended memory. TPCX enables
you to build very large real mode programs from the
command-line. TPCX is included in the professional version only.
o Built-in, inline assembler - Write assembly language instructions
inside your Turbo Pascal programs.
o Other enhancements
o Private fields and methods in objects (module-based)
o New heap manager
o Support for extended syntax ($X directive)
o 80286 code generation ($G directive)
o Code generation improvements
o Address references in typed constant pointers
o Link in initialized data from .OBJs ($L)
You can run the extended command-line compiler, TPCX.EXE, if you have
a 80286, 80386 or 80486 machine with at least a megabyte of extended
memory. By running in protected mode and using extended memory, TPCX
can compile very large programs. Both TPC and TPCX generate real mode
programs only. Note that TPCX can only make use of extended
memory--not expanded memory (EMS).
The command-line parameters for TPCX are identical to those of TPC.
TPCX is much larger than TPC and running in protected mode involves
more overhead than running in real mode; use TPC.EXE to do your
command-line compiling unless you need the extended memory capacity of
TPCX.
Far and near directives can be used and they always override the {$F}
compiler directive state:
procedure MyProc1; far; { always far, even if $F- }
procedure MyProc2; near; { always near, even if $F+ }
Of course, procedures declared in the interface section of a
unit are always far (far and near are only valid in the
implementation section of a unit or in the main program).
=
New Heap Manager!! Wow! Alright! Shit, this might suck! I don't know,
I'm not a professional! Geez!!!!
=
Here's a memory map of the new heap manager:
------------------------ <--HeapEnd (points to end of heap)
| . |
| . |
| Last used block |<--HeapPtr (points after last used block)
| . |
| Avail block |<--FreeList (points to first block in
| . | free list chain)
------------------------ <--HeapOrg (points to beginning of heap)
| Overlay heap |
------------------------
| Stack (grows |
| . downward) |
| . |
------------------------
| DS |
------------------------
| Code |
------------------------
| DOS |
------------------------
Turbo Pascal's new heap manager is similar to the one in version 3.0.
The FreeList variable in the System unit points to the first free
lock in the heap. This block contains a pointer to the next free
lock, which contains a pointer to the following free block, and
so on. The last free block, contains a pointer to the top of the
heap, i.e. to the location given by HeapPtr. If there are no free
blocks on the free list, FreeList will be equal to HeapPtr.
The format of the first eight bytes of a free block are given by
the TFreeRec type below.
type
PFreeRec = ^TFreeRec;
TFreeRec = record
Next: PFreeRec;
Size: Pointer;
end;
The Next field points to the next free block, or to the same
location as HeapPtr if the block is the last free block. The Size
field encodes the size of the free block. The value in Size is
not a normal 32-bit value; rather, it is a "normalized" pointer
value, with a count of free paragraphs (16-byte blocks) in the
high word, and a count of free bytes (between 0 and 15) in the
low word. The BlockSize function below converts a Size field
value to a normal Longint value:
function BlockSize(Size: Pointer): Longint;
type
PtrRec = record Lo, Hi: Word end;
begin
BlockSize := Longint(PtrRec(Size).Hi) * 16 + PtrRec(Size).Lo;
end;
To guarantee that there will always be room for a TFreeRec at the
beginning of a free block, the heap manager rounds the size of
every block allocated by New or GetMem upwards to an 8-byte
boundary. Thus, 8 bytes are allocated for blocks of size 1..8, 16
bytes are allocated for blocks of size 9..16, and so on. This may
seem an excessive waste of memory at first, and indeed it would
be if every block was just 1 byte in size. However, blocks are
typically larger, and so the relative size of the unused space is
less. Furthermore, and quite importantly, the 8-byte granularity
factor ensures that a number of random allocations and
deallocations of blocks of varying small sizes, such as would be
typical for variable-length line records in a text- processing
program, do not heavily fragment the heap. For example, say a 50
byte block is allocated and disposed of, thus becoming an entry
on the free list. The block would have been rounded to 56 bytes
(7*8), and a later request to allocate anywhere from 49 to 56
bytes would completely reuse the block, instead of leaving 1 to 7
bytes of free (but most likely unusable) space, which would
fragment the heap.
IMPORTANT NOTE: If you write a HeapError function, it must
correctly handle the case where the size parameter is zero. (This
is a change from TP 5.x when HeapError was never called if Size =
0. ) To correctly handle the situation when Size=0 simply return
any value. The return value will be ignored.
New Compiler Directives
-----------------------
80286 Code Generation
Syntax: {$G+} or {$G-}
Default: {$G-}
Type: Local
Menu equivalent: Options/Compiler/Code Generation
The $G directive enables or disables 80286 code generation. In
the {$G-} state, only generic 8086 instructions are generated,
and programs compiled in this state can run on any 80x86 family
processor. In the {$G+} state, the compiler uses the additional
instructions of the 80286 to improve code generation, but
programs compiled in this state cannot run on 8088 and 8086
processors. Additional instructions used in the {$G+} state
include ENTER, LEAVE, PUSH immediate, extended IMUL, and extended
SHL and SHR.
Note that this directive works only in real mode, not in
protected mode.
Extended Syntax
Syntax: {$X+} or {$X-}
Default: {$X-}
Type: Global
Menu equivalent: ....
The $X compiler directive enables or disables Turbo Pascal's
extended syntax:
o Function statements. In the {$X+} mode, functions calls can be
used as statements, i.e. the result of a function call can be
discarded. Generally, the computations performed by a function
are represented through its result, so discarding the result
makes little sense. However, in certain cases a function can
carry out multiple operations based on its parameters, and
some of those cases may not produce a sensible result--in such
cases, the {$X+} extensions allow the function to be treated
as a procedure.
NOTE: The {$X+} directive does not apply to built-in
functions, i.e. functions defined in the System unit.
New Compiler Error Messages
---------------------------
155 Invalid combination of opcode and operands.
The assembler opcode does not accept this combination of
operands. Possible causes are:
o There are too many or too few operands for this assembler opcode; for
example INC AX,BX or MOV AX.
o The number of operands is correct, but their types or order do not
match the opcode; for example DEC 1, MOV AX,CL or MOV 1,AX.
156 Memory reference expected.
The assembler operand is not a memory reference, which is
required here. Most likely you have forgotten to put square
brackets around an index register operand, for example MOV
AX,BX+SI instead of MOV AX,[BX+SI].
157 Cannot add or subtract relocatable symbols.
The only arithmetic operation that can be performed on a
relocatable symbol in an assembler operand is addition or
subtraction of a constant. Variables, procedures, functions, and
labels are relocatable symbols. Assuming that Var is a variable
and Const is a constant, then the instructions MOV AX,Const+Const
and MOV AX,Var+Const are valid, but MOV AX,Var+Var is not.
158 Invalid register combination.
Valid index register combinations are [BX], [BP], [SI], [DI],
[BX+SI], [BX+DI], [BP+SI], and [BP+DI]. Other index register
combinations, such as [AX], [BP+BX], and [SI+DX], are not
allowed.
Note: Local variables (variables declared in procedures and
functions) are always allocated on the stack and accessed via the
BP register. The assembler automatically adds [BP] in references
to such variables, so even though a construct like Local[BX]
(where Local is a local variable) appears valid, it is not since
the final operand would become Local[BP+BX].
159 286/287 instructions are not enabled.
Use a {$G+} compiler directive to enable 286/287 opcodes, but be aware
that the resulting code cannot be run on 8086 and 8088 based machines.
160 Invalid symbol reference.
This symbol cannot be accessed in an assembler operand. Possible causes
are:
o You are attempting to access a standard procedure, a standard
function, or the Mem, MemW, MemL, Port, or PortW special
arrays in an assembler operand.
o You are attempting to access a string, floating-point, or set
constant in an assembler operand.
o You are attempting to access an inline procedure or function in an
assembler operand.
o You are attempting to access the @Result special symbol outside a
function.
o You are attempting to generate a short JMP instruction that jumps
to something other than a label.
161 Code generation error.
The preceding statement part contains a LOOPNE, LOOPE, LOOP, or
JCXZ instruction that cannot reach its target label.
162 ASM expected.
New Runtime Error Messages
--------------------------
211 Call to abstract method.
This error is generated by the Abstract procedure in the Objects
unit; it indicates that your program tried to execute an abstract
virtual method. When an object type contains one or more abstract
methods it is called an abstract object type. It is an error to
instantiate objects of an abstract type--abstract object types
exist only so that you can inherit from them and override the
abstract methods. For example, the Compare method of the
TSortedCollection type in the Objects unit is abstract,
indicating that to implement a sorted collection you must create
an object type that inherits from TSortedCollection and overrides
the Compare method.
212 Stream registration error.
This error is generated by the RegisterType procedure in the
Objects unit indicating that one of the following errors have
occurred:
o The stream registration record does not reside in the data segment.
o The ObjType field of the stream registration record is zero.
o The type has already been registered.
o Another type with the same ObjType value already exists.
213 Collection index out of range.
The index passed to a method of a TCollection is out of range.
214 Collection overflow error.
The error is reported by a TCollection if an attempt is made to
add an element when the collection cannot be expanded.
IMPORTANT NOTES
---------------
o Programs compiled with {$G+} (generate 286 code) do not check the
processor type at startup. Trying to run 80286 instructions on an
8088 will lock up the computer.
o The {$X+} compiler directive is global, so it must appear in the source
code before any declarations or program statements. {$X} elsewhere will
cause an "Invalid Compiler Directive" error at compile time.
o The following command-line parameters are defined:
Default
-------
-G Full graphics memory save Off
-P EGA and VGA palette save Off
-X Uses expanded memory (EMS) if available On
-D Dual monitor support during debugging Off
IDE Internal Workspaces Default Min Max
----------------------- ------- --- ---
-H Internal heap 32 24 128
-O Overlay buffer 112 64 256
-E Editor heap 28 28 128
The syntax of a switch directive is:
-Xs where X is G,P,X or D and s is a plus (+) or a
space, which turn the switch ON, or a minus (-),
which turns the switch off.
Note that in this beta version, command-line options must be
separated by spaces and may start with a dash (-) or a slash (/):
turbo -g -p myfile - Graphics and palette save
turbo -x+ -o64 - Use EMS and shrink overlay buffer
to 64 Kbytes